/**══════════════════════════════════╗
*作    者：songbaobao                                                  ║
*职    业：我以我血荐轩辕                                              ║
*CSND地址：https://blog.csdn.net/weixin_43949535                       ║
**GitHub ：https://github.com/TsinghuaLucky912/My_own_C-_study_and_blog║
**GitEE  ：https://gitee.com/lucky912_admin/code-up_-pat               ║
*═══════════════════════════════════╣
*创建时间：                                                         
*功能描述：                                              
*                                                                      
*                                                                      
*═══════════════════════════════════╣
*结束时间:                                                           
*═══════════════════════════════════╝
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//              西南\./联大               \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
*/
#include <iostream>
#include <vector>
#include <string.h>
#include <unordered_map>
#include <ctype.h>
#include <queue>
#include <list>
#include <map>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

#if C
struct Student
{
	char num[64];
	char name[128];
	char sex[64];
	int age;
};
#endif

#if E
struct Student
{
	int num;
	char name[128];
	char sex[64];
	int age;
};
#endif

int main()
{
#if A
	int N, score, n, index = 0;
	int myarray[1001] = { 0 };
	int myresult[1001] = { 0 };

	while (scanf("%d", &N), N)
	{
		n = N;
		for (int i = 0; i < n; ++i)
		{
			scanf("%d", myarray + i);
		}
		scanf("%d", &score);

		for (int i = 0; i < n; ++i)
		{
			if (myarray[i] == score)
				myresult[index]++;
		}

		memset(myarray, 0, 1001 * sizeof(int));
		index++;
	}
	for (int i = 0; i < index; ++i)
	{
		printf("%d\n", myresult[i]);
	}
#endif

#if B
	int n, N;
	int myarray[201] = { 0 };
	while (EOF != scanf("%d", &n))
	{
		int x;
		for (int i = 0; i < n; ++i)
		{
			scanf("%d", myarray + i);
		}
		scanf("%d", &x);

		/*
		sort(myarray, myarray + n);

		int low = 0, high = n, mid;
		while (low <= high)
		{
			mid = (high - low) / 2 + low;
			if (x == myarray[mid])
			{
				printf("%d\n", mid);
				break;
			}
			else if (x < myarray[mid])
			{
				high = mid;
			}
			else
				low = mid;
		} */

		int i = 0;
		for (; i < n; ++i)
		{
			if (myarray[i] == x)
			{
				printf("%d\n", i);
				break;
			}
		}
		if (i == n)
		{
			printf("%d\n", -1);
		}
		memset(myarray, 0, 201 * sizeof(int));
	}
#endif

#if C
	int N, M;
	
	while (EOF != scanf("%d", &N))
	{
		Student student[1000];
		for (int i = 0; i < N; ++i)
		{
			scanf("%s", (student + i)->num);
			scanf("%s", (student + i)->name);
			scanf("%s", (student + i)->sex);
			scanf("%d", &((student + i)->age));
		}

		scanf("%d", &M);

		for (int i = 0; i < M; ++i)
		{
			char index[64] = { 0 };
			scanf("%s", &index);
			int j = 0;
			for (; j < N; ++j)
			{
				if (strcmp(index ,student[j].num)==0)
				{
					printf("%s %s %s %d\n", student[j].num, student[j].name, student[j].sex, student[j].age);
					break;
				}
			}
			if (j == N)
			{
				printf("No Answer!\n");
			}
		}
	}
#endif

#if D
	int n, m;
	int a[101] = { 0 };
	int b[101] = { 0 };

	while (EOF != scanf("%d", &n))
	{
		for (int i = 0; i < n; ++i)
		{
			scanf("%d", a + i);
		}

		scanf("%d", &m);
		for (int j = 0; j < m; ++j)
		{
			scanf("%d", b + j);
		}
		for (int i = 0; i < m; ++i)
		{
			int j = 0;
			for (; j < n; ++j)
			{
				if (a[j] == b[i])
				{
					printf("YES\n");
					break;
				}
			}
			if (j == n)
				printf("NO\n");
		}
		
		memset(a, 0, sizeof(int) * 101);
		memset(b, 0, sizeof(int) * 101);
	}
#endif

#if E
	int N;
	while (EOF != scanf("%d", &N))
	{
		while (N--)
		{
			int M, num;
			scanf("%d", &M);
			Student student[21];

			for (int i = 0; i < M; ++i)
			{
				scanf("%d", &((student + i)->num));
				scanf("%s", (student + i)->name);
				scanf("%s", (student + i)->sex);
				scanf("%d", &((student + i)->age));
			}
			scanf("%d", &num);
			for (int i = 0; i < M; ++i)
			{
				if (num == student[i].num)
					printf("%d %s %s %d\n", student[i].num, student[i].name, student[i].sex, student[i].age);
			}
		}
	}
#endif
	return 0;
}
/**
*备用注释：
*
*
*
*/
